package com.car.loan.project.xr.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.Collection;
import java.util.List;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.car.loan.project.xr.mapper.CustomerSpouseMapper;
import com.car.loan.project.xr.domain.CustomerSpouse;
import com.car.loan.project.xr.service.ICustomerSpouseService;

/**
 * 客户配偶Service业务层处理
 *
 * @author ruoyi
 * @date 2019-11-03
 */
@Service
public class CustomerSpouseServiceImpl implements ICustomerSpouseService {

    @Autowired
    private CustomerSpouseMapper customerSpouseMapper;

    /**
     * 查询客户配偶
     *
     * @param id 客户配偶ID
     * @return 客户配偶
     */
    @Override
    public CustomerSpouse selectCustomerSpouseById(Long id) {
        return customerSpouseMapper.selectById(id);
    }

    /**
     * 查询客户配偶列表
     *
     * @param customerSpouse 客户配偶
     * @return 客户配偶
     */
    @Override
    public List<CustomerSpouse> selectCustomerSpouseList(CustomerSpouse customerSpouse) {
        QueryWrapper<CustomerSpouse> queryWrapper = new QueryWrapper<>(customerSpouse);
        return customerSpouseMapper.selectList(queryWrapper);
    }


    @Override
    public IPage<CustomerSpouse> selectPage(IPage<CustomerSpouse> page,
        QueryWrapper<CustomerSpouse> queryWrapper) {
        return customerSpouseMapper.selectPage(page, queryWrapper);
    }

    /**
     * 新增客户配偶
     *
     * @param customerSpouse 客户配偶
     * @return 结果
     */
    @Override
    public int insertCustomerSpouse(CustomerSpouse customerSpouse) {

        return customerSpouseMapper.insert(customerSpouse);
    }

    /**
     * 修改客户配偶
     *
     * @param customerSpouse 客户配偶
     * @return 结果
     */
    @Override
    public int updateCustomerSpouse(CustomerSpouse customerSpouse) {

        return customerSpouseMapper.updateById(customerSpouse);
    }

    /**
     * 删除客户配偶对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCustomerSpouseByIds(Collection<Long> ids) {
        return customerSpouseMapper.deleteBatchIds(ids);
    }

    /**
     * 删除客户配偶信息
     *
     * @param id 客户配偶ID
     * @return 结果
     */
    @Override
    public int deleteCustomerSpouseById(Long id) {
        return customerSpouseMapper.deleteById(id);
    }
}
